<?php
/**
 * Created by PhpStorm.
 * User: zhanglihe
 * Date: 2018/6/1
 * Time: 下午2:19
 */

namespace Modules\Admin\Auth\Controllers;

use App\Http\Controllers\Controller;
use App\Models\Pay;
use App\Models\RechargeOrder;
use App\Models\RechargeOrderDetail;
use App\Models\User;
use App\Models\UserCoupon;

class IndexController extends Controller
{
    public function index()
    {
        /*
        $stat = [
            'total_users'           => User::count(),
            'total_recharge_users'  => User::where('recharge_amount', '>', 0)->count(),
            'total_pay_amount'      => Pay::where('is_paid', 1)->sum('amount'),
            'total_recharge_amount' => RechargeOrderDetail::sum('amount') +
                RechargeOrder::where('type', 2)->where('status', '>', '0')->sum('recharge_amount'),
            'total_wait_amount'     => RechargeOrderDetail::where('is_paid', 0)->sum('amount') +
                RechargeOrder::where('type', 2)->whereIn('status', [1,2])->sum('recharge_amount'),
            'total_amount_one'     => RechargeOrderDetail::where('is_paid', 1)->sum('amount') +
                RechargeOrder::where('type', 2)->whereIn('status', [3])->sum('recharge_amount'),
            'total_coupon_one' => UserCoupon::count(),
            'total_coupon_used'=>UserCoupon::where('status',2)->count(),
            'total_coupon_amount' => UserCoupon::where('status',2)->sum('amount')
        ];

        \Request::merge(['stat' => $stat]);
        */

        return view('admin.auth::welcome', \Request::all());
    }
}